import { defineView } from "@/routers/tools.mjs";

/**
 * @type {DefineView}
 */
const ClassRerunView = defineView({
  controller: class {
    static $inject = ["$scope"];

    /**
     * @param {ng.IScope} $scope
     */
    constructor($scope) {
      this.$scope = $scope;
      this.count = 0;
    }

    onClick() {
      const count2 = this.count * 2;
      console.log(count2);
      this.increment();
    }

    increment() {
      this.count++;
    }

    handleClick() {
      console.log("ClassRerunView", this.$scope);
    }
  },
  controllerAs: "$ctrl",
  template: /* HTML */ html`
    <div>
      <p>Click Me {{$ctrl.count}}</p>
      <button ng-click="$ctrl.onClick()">Increment</button>
    </div>
  `,
});

export default ClassRerunView;
